/*
 * @Author: gyh
 * @Date: 2024-05-10 10:18:51
 * @LastEditTime: 2024-05-10 15:47:20
 */
import { request } from '@/utils/request'
import type { address, addressParams } from '@/types/address'

export const addAddressApi = (data: addressParams) => {
  return request<{ id: string }>({
    method: 'POST',
    url: '/member/address',
    data,
  })
}

export const deleteAddressApi = (id: string) => {
  return request<{ id: string }>({
    method: 'DELETE',
    url: `/member/address/${id}`,
  })
}

export const editAddressApi = (id: string, data: addressParams) => {
  return request<{ id: string }>({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}

export const getAddressListApi = () => {
  return request<address[]>({
    method: 'GET',
    url: '/member/address',
  })
}

export const getAddressByIdApi = (id: string) => {
  return request<address>({
    method: 'GET',
    url: `/member/address/${id}`,
  })
}
